Skip to content

unify(gamelogic): Merge GameLogicDispatch and related code and move most GameLogic System files to Core#2698

Merged
xezon merged 2 commits into
TheSuperHackers:mainfrom
xezon:xezon/unify-gamelogicdispatch
May 12, 2026
Merged

unify(gamelogic): Merge GameLogicDispatch and related code and move most GameLogic System files to Core#2698
xezon merged 2 commits into
TheSuperHackers:mainfrom
xezon:xezon/unify-gamelogicdispatch

Conversation

@xezon

@xezon xezon commented May 10, 2026

Copy link
Copy Markdown

Merge with Rebase

This change merges GameLogicDispatch and related code and moves most GameLogic System files to Core.

GameLogic.cpp was not moved because that still requires complicated merges.

Generals gets

  • Screen Fade for Score Screen

TODO

  • Add pull id to commit titles.

@xezon xezon added this to the Code foundation build up milestone May 10, 2026
@xezon xezon added Gen Relates to Generals ZH Relates to Zero Hour Unify Unifies code between Generals and Zero Hour labels May 10, 2026
@greptile-apps

greptile-apps Bot commented May 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR unifies GameLogicDispatch and several related GameLogic system files (CaveSystem, CrateSystem, Damage, RankInfo) by moving them from game-specific directories into Core/, updating all three CMakeLists accordingly. It also ports the "Screen Fade for Score Screen" from Zero Hour to Generals by merging the Zero Hour clearGameData transition calls into the new unified file.

  • File movement: Headers and sources for CaveSystem, CrateSystem, Damage, and RankInfo are deleted from Generals/ and moved verbatim to Core/; CMakeLists for Generals, GeneralsMD, and Core are updated symmetrically to avoid duplicate compilation units.
  • GameLogicDispatch merge: The unified Core file incorporates Zero Hour additions — MSG_ENABLE_RETALIATION_MODE handling (with correct RETAIL_COMPATIBLE_CRC branching) and a screen-fade transition around the score screen push — on top of the Generals baseline; nullptr is used consistently throughout.
  • Generals Player additions: m_logicalRetaliationModeEnabled and MSG_ENABLE_RETALIATION_MODE are scaffolded into the Generals Player/MessageStream, but Player::update() posting code (present in GeneralsMD) is not yet ported, so the field remains FALSE in the Generals build.

Confidence Score: 5/5

Safe to merge — this is a code-organisation change that moves files to Core/ without altering game logic, and the screen-fade addition is a straightforward port from Zero Hour.

The file movement is clean and symmetric across all three CMakeLists files. The unified GameLogicDispatch is a faithful merge with correct RETAIL_COMPATIBLE_CRC branching for retaliation mode. No game logic is changed for either build; the only new Generals behaviour is the score-screen fade transition. The retaliation-mode scaffolding added to Generals Player is incomplete (posting code absent) but has no runtime effect since no Generals-specific game logic reads the field.

Generals/Code/GameEngine/Include/Common/Player.h — the header comment implies Player::update() posts MSG_ENABLE_RETALIATION_MODE, but that code is not present in the Generals build.

Important Files Changed

Filename Overview
Core/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp New Core file: unified merge of Generals + Zero Hour GameLogicDispatch, adds screen fade on score screen and MSG_ENABLE_RETALIATION_MODE handling; uses nullptr throughout; RETAIL_COMPATIBLE_CRC #ifdef paths are consistent with the message-posting side in GeneralsMD/Player.cpp.
Generals/Code/GameEngine/Include/Common/Player.h Adds m_logicalRetaliationModeEnabled field and accessors; the header comment states Player::update() will post MSG_ENABLE_RETALIATION_MODE on change, but that posting code is absent from Generals/Player.cpp (it only exists in GeneralsMD/Player.cpp).
Generals/Code/GameEngine/Source/Common/RTS/Player.cpp Initializes m_logicalRetaliationModeEnabled = FALSE in init(); constructor already calls init(nullptr), so no uninitialized-member risk; no serialization change needed since the field is re-derived from GlobalData each update.
Generals/Code/GameEngine/Include/Common/MessageStream.h Adds MSG_ENABLE_RETALIATION_MODE enum value before the debug-network sentinel; enum value ordering is safe.
Core/GameEngine/CMakeLists.txt Uncomments CaveSystem, CrateSystem, Damage, RankInfo headers and sources plus GameLogicDispatch and RankInfo source files to include them in the Core build.
Generals/Code/GameEngine/CMakeLists.txt Comments out the same set of files now provided by Core, correctly mirroring the Core CMakeLists changes to avoid duplicate compilation units.
GeneralsMD/Code/GameEngine/CMakeLists.txt Same as Generals CMakeLists — comments out files now provided by Core; symmetrical with Generals changes.
scripts/cpp/unify_move_files.py Whitespace fix (trailing space removed) and adds commented-out entries tracking the files moved in this PR for future reference.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before
        G1[Generals/GameLogicDispatch.cpp]
        G2[Generals/CaveSystem.h+cpp]
        G3[Generals/CrateSystem.h+cpp]
        G4[Generals/Damage.h+cpp]
        G5[Generals/RankInfo.h+cpp]
        ZH1[GeneralsMD/GameLogicDispatch.cpp]
    end

    subgraph After
        C1[Core/GameLogicDispatch.cpp\nMerged: Generals + ZH\n+ Screen Fade\n+ MSG_ENABLE_RETALIATION_MODE]
        C2[Core/CaveSystem.h+cpp]
        C3[Core/CrateSystem.h+cpp]
        C4[Core/Damage.h+cpp]
        C5[Core/RankInfo.h+cpp]
        GPlayer[Generals/Player.h+cpp\n+ m_logicalRetaliationModeEnabled\n+ MSG_ENABLE_RETALIATION_MODE]
        GMsgStream[Generals/MessageStream.h\n+ MSG_ENABLE_RETALIATION_MODE]
    end

    G1 -->|deleted, merged into| C1
    ZH1 -->|merged into| C1
    G2 -->|moved to| C2
    G3 -->|moved to| C3
    G4 -->|moved to| C4
    G5 -->|moved to| C5
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
Generals/Code/GameEngine/Include/Common/Player.h:651-655
**Comment describes behavior absent in the Generals build**

The inline comment states that `Player::update()` detects a change in `TheGlobalData->m_clientRetaliationModeEnabled` and posts `MSG_ENABLE_RETALIATION_MODE`. That posting code exists in `GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp` but is **not** present in `Generals/Code/GameEngine/Source/Common/RTS/Player.cpp`. As a result, `m_logicalRetaliationModeEnabled` will always remain `FALSE` in the Generals build, and the comment will mislead future contributors who look here. Is this intentional scaffolding for a future port, or was the `Player::update()` posting block meant to be included in this PR?

Reviews (2): Last reviewed commit: "unify(gamelogic): Move most GameLogic Sy..." | Re-trigger Greptile

@Skyaero42 Skyaero42 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@xezon xezon force-pushed the xezon/unify-gamelogicdispatch branch from 73ca23d to 0116c4c Compare May 12, 2026 17:57
@xezon xezon merged commit e887d02 into TheSuperHackers:main May 12, 2026
17 checks passed
@xezon xezon deleted the xezon/unify-gamelogicdispatch branch May 12, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen Relates to Generals Unify Unifies code between Generals and Zero Hour ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants